/*
 * @Author: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @Date: 2022-11-04 14:51:59
 * @LastEditors: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @LastEditTime: 2022-11-04 19:33:40
 * @FilePath: \宏烨找房\agent\src\page\bulk\index.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React ,{ useEffect,useState }from 'react'
import './index.css'
import { ArrowLeft, Ellipsis, Search,  } from '@react-vant/icons';
import { Switch, Button } from 'react-vant';
import { useNavigate  } from 'react-router-dom';
import { httpGetBulk } from '../../api/bulk';
const Bulk=()=> {
  const [data,setData]=useState([])
    const navigate=useNavigate();
    // 返回登录页面
    const back = () => {
        navigate('/home')
    }
    const getData=async ()=>{
      const res=await httpGetBulk('/agentBulk');
      console.log(res);
      setData(res.data.list)
    }
  useEffect(()=>{
    getData()
  },[])
  return (
    <div className='box'>
          <div className='topHouse'>
              <ArrowLeft onClick={() => back()} />
              <b>团购</b>
              <Ellipsis />
          </div>

          <div className="content">
              {
                data&&data.map((item,index)=>{
                  return (
                    <div key={index} className="bulkBox">
                       {
                        data&&data.map((item,index)=>{
                          return (
                           <div className='bulk'>
                              <img src={item.img} alt="" style={{ width: '100%', height: '200px' }} />
                              <b style={{fontSize:'18px'}}>{item.name}</b>
                              <p>{item.title}</p>
                              <p className='itemBox'>
                                <span>活动时间:{item.time}</span>
                                <span>已报名:{item.num}人</span>
                              </p>
                              <div className='option'>
                                <div style={{padding:'10px'}}><Switch defaultChecked size ='20px'/>;</div>
                                <div>
                                  <Button type='primary' >开团</Button>
                                  <Button type='default' >删除</Button>
                                </div>
                              </div>
                           </div>
                            
                          )
                        })
                       }
                    </div>
                  )
                })
              }
          </div>
    </div>
  )
}
export default Bulk;